package com.chinasoft.service.impl;

import com.chinasoft.dao.AccountDao;
import com.chinasoft.service.AccountService;


public class AccountServiceImpl implements AccountService {

    private AccountDao accountDao;

    public void setAccountDao(AccountDao accountDao) {
        this.accountDao = accountDao;
    }
//
//    private DataSource dataSource;
//
//    public void setDataSource(DataSource dataSource) {
//        this.dataSource = dataSource;
//    }

    @Override
    public void transfer(String outName, String inName, Double money) {
//        //开启事务
//        PlatformTransactionManager ptm = new DataSourceTransactionManager(dataSource);
//        //事务定义
//        TransactionDefinition td = new DefaultTransactionDefinition();
//        //事务状态
//        TransactionStatus ts = ptm.getTransaction(td);

        accountDao.outMoney(outName,money);
        //int i = 1/0;
        accountDao.inMoney(inName,money);

        //提交事务
//        ptm.commit(ts);
    }
}